# ------------------------------------------------------------
# ::                        WIGA-SOFT                       ::
# ------------------------------------------------------------
# admin.py
# Adminstration interface for models
# Created by: Vycas
# Version: 1.0
# ------------------------------------------------------------

from django.contrib import admin
from pao.models import Employee, Task, Budget, Department, Project


class EmployeeAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'department')
    list_filter = ('department',)


class TaskAdmin(admin.ModelAdmin):
    def department(self, obj):
        return obj.employee.department
    
    list_display = ('__unicode__', 'project', 'department', 'employee', 'date', 'workhours')
    list_filter = ('employee', 'project', 'date')


class BudgetAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'project', 'date', 'workhours')
    list_filter = ('project', 'date')


class DepartmentAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'manager')
    list_filter = ('manager',)


class ProjectAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'manager')
    list_filter = ('manager',)


admin.site.register(Employee, EmployeeAdmin)
admin.site.register(Department, DepartmentAdmin)
admin.site.register(Project, ProjectAdmin)
admin.site.register(Task, TaskAdmin)
admin.site.register(Budget, BudgetAdmin)
